package presencial2014;
import java.util.ArrayList;
import java.util.Scanner;

public class C {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int nPasajeros = in.nextInt();

		while (nPasajeros != 0) {

			// CONFIGURACION BARCO
			ArrayList<Integer> cola = new ArrayList<Integer>();
			for (int i = 0; i < nPasajeros; i++) {
				cola.add(in.nextInt());
			}

			// CONSULTAS
			int nConsultas = in.nextInt();
			in.nextLine(); // SI NO NO FUNCIONA

			for (int consultas = 0; consultas < nConsultas; consultas++) {
				String instruccion = in.nextLine();
				String[] ins = instruccion.split(" ");
				if (ins[0].equals("EMBARQUE")) {
					cola = quitar(cola, Integer.parseInt(ins[1]));
					System.out.println(cola.size());
				} else {
					System.out.println(cola.get(Integer.parseInt(ins[1]) - 1));
				}
			}
			System.out.println("*");
			nPasajeros = in.nextInt();
		}
	}

	private static ArrayList<Integer> quitar(ArrayList<Integer> cola, int n) {
		ArrayList<Integer> colaNueva = new ArrayList<Integer>();
		for (int i : cola) {
			if (i != n) {
				colaNueva.add(i);
			}
		}
		return colaNueva;
	}

}
